package com.core.controller;

import java.util.ArrayList;
import java.util.List;

/**
 * @author SunChangSheng
 * @apiNote
 * @since 2021/8/26 15:40
 */
public class Demo {
    /**
     * 1.两数相加
     * @param nums
     * @param target
     * @return
     */
    public static int[] twoSum(int[] nums, int target) {
        //遍历数组，两两相加，如果等于目标，则返回下标
        int length = nums.length;
        int[] res = new int[2];
        for (int i = 0; i < length; i++) {
            for (int j = 0; j < length; j++) {
                if (nums[i] + nums[j] == target) {
                    res[0] = i;
                    res[1] = j;
                    break;
                }
            }
        }
        return res;
    }

    public static void main(String[] args) {
        List list=new ArrayList();
        list.add("scs");
        list.add("scs");
        System.out.println(list.size());
    }

}
